package com.infore.airsupervise.ui.fragment;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.infore.airsupervise.R;
import com.infore.airsupervise.app.Constants;
import com.infore.airsupervise.ui.activity.StationDetailActivity;
import com.infore.airsupervise.ui.activity.StationHistoryActivity;
import com.infore.airsupervise.ui.activity.StationPhotoActivity;
import com.infore.airsupervise.ui.activity.StationVideoActivity;
import com.infore.airsupervise.utils.JumpUtil;
import com.infore.airsupervise.utils.ToastUtil;

import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by xiaotao on 2017/7/31.
 */

public class AQIDrawerFragment extends BaseFragment {
    private String mn= null;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_aqi_drawer, container, false);
        unbinder = ButterKnife.bind(this, view);
        return view;
    }

    public  void setStationMN(String mn){
        this.mn = mn;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
    }

    @OnClick({R.id.tv_history, R.id.tv_detail, R.id.tv_photo, R.id.tv_video})
    public void onViewClicked(View view) {
        if(TextUtils.isEmpty(mn)){
            ToastUtil.showShort(getContext(),"参数不完整，请退出重试！");
            return ;
        }
        switch (view.getId()) {
            case R.id.tv_history:
                JumpUtil.jumpFromTo(getContext(), StationHistoryActivity.class,Constants.INTENT_STR_KEY, mn);
                break;
            case R.id.tv_detail:

                JumpUtil.jumpFromTo(getContext(), StationDetailActivity.class, Constants.INTENT_STR_KEY, mn);
                break;
            case R.id.tv_photo:
                JumpUtil.jumpFromTo(getContext(), StationPhotoActivity.class,Constants.INTENT_STR_KEY, mn);
                break;
            case R.id.tv_video:
                JumpUtil.jumpFromTo(getContext(), StationVideoActivity.class);
                break;
        }
    }
}
